#include <iostream>
#include <vector>
using namespace std;

int cmmdc(int, int);
int cmmdc(vector<int>);

int main()
{
    int dimensiune;
    cout<<"introduceti dimensiunea:";
    cin>>dimensiune;
    vector <int> x(dimensiune);
    for (int i=0;i<dimensiune;i++)
    {
        cout<<"v["<<i<<"]=";
        cin>>x[i];
    }
    
    cout<<"cmmdc dintre 100 si 45 este "<<cmmdc(100,45)<<endl;
    cout<<"cmmdc al elementelor sirului: "<<cmmdc(x);
}

int cmmdc(int x, int y)
{
    int t;
    while (y!=0)
    {
        t=y;
        y=x%y;
        x=t;
    }
    return x;
}

int cmmdc(vector<int> v)
{
    int global_cmmdc=cmmdc(v[0], v[1]);
    for (int i=0; i<v.size();i++)
        for (int j=0;j<v.size();j++)
        {
            int ss=cmmdc(v[i], v[j]);
            if (ss<global_cmmdc)
                global_cmmdc=ss;
        }
    return global_cmmdc;
}